<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="shortcut icon" href="/img/favicon.png">
  <link rel="stylesheet/less" href="/less/index.less">
  <link rel="stylesheet" href="/css/toastr.min.css">
  <script src="/js/less-2.7.2.js"></script>
  <title>聊天室</title>
</head>
<body>
  <div id="app">
    <div class="login" v-if="isLogin">
      <input type="text" placeholder="请输入用户名，回车确认" @keyup.enter="login">
    </div>
    <div class="chatroom" v-cloak v-if="!isLogin">
      <div class="left">
        <ul class="member-list">
          <li v-for="user in users">{{user}}</li>
        </ul>
        <div class="notify" v-html="notify"></div>
      </div>
      <div class="right">
        <ul class="msg-list">
          <li class="other" v-for="msg in message" v-if="msg.username != username">
            <div class="info">
              <img src="/img/avatar.jpg" alt="">
              <span>{{ msg.username }}</span>
            </div>
            <p class="msg">{{ msg.msg }}</p>
          </li>
          <li class="self" v-else>
            <div class="info">
              <span>{{ msg.username }}</span>
              <img src="/img/avatar.jpg" alt="">
            </div>
            <p class="msg">{{ msg.msg }}</p>
          </li>
        </ul>
        <div class="textarea">
          <textarea @keyup.enter="send"></textarea>
          <div class="btns">
            <span @click="exit">关闭</span>
            <span @click="send">发送</span>
          </div>
        </div>
      </div>
    </div>
  </div>

<!-- CDN -->
<script src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script src="//cdn.bootcss.com/vue/2.3.3/vue.min.js"></script>
<script src="//cdn.bootcss.com/toastr.js/latest/js/toastr.min.js"></script>
<script src="//cdn.bootcss.com/socket.io/2.0.3/socket.io.js"></script>
<!--  -->
<!-- <script src="/js/jquery-3.2.1.js"></script> -->
<!-- <script src="/js/toastr.min.js"></script> -->
<!-- <script src="/js/vue-2.3.3.js"></script> -->
<!-- <script src="/js/socket.io-2.0.3.min.js"></script> -->
<script src="/js/index.js"></script>
</body>
</html>
